//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by FernFlower decompiler)
//

package com.lyq.bean.mySql;

import java.sql.Connection;
import java.sql.PreparedStatement;

public class UpdateS_Sql {
    public UpdateS_Sql() {
    }

    public Boolean updateS_Sql(String No, String name, String sex, String age, String collage, String department, String pwd) {
        (new MysqlLinking()).getLink();
        Connection conn = MysqlLinking.conn;
        Boolean bool = false;

        try {
            String sql = "update student set S_Name=?,S_Sex=?,S_Age=?,S_Collage=?,S_Department=?,S_Pwd=? where S_No=?";
            PreparedStatement ps = conn.prepareStatement(sql);
            ps.setString(1, name);
            ps.setString(2, sex);
            ps.setString(3, age);
            ps.setString(4, collage);
            ps.setString(5, department);
            ps.setString(6, pwd);
            ps.setString(7, No);
            int rs = ps.executeUpdate();
            if (rs > 0) {
                bool = true;
            }

            ps.close();
        } catch (Exception var14) {
            Exception e = var14;
            e.printStackTrace();
        }

        return bool;
    }
    
    // 添加更新学生GPA的方法
    public Boolean updateStudentGPA(String No, double gpa) {
        (new MysqlLinking()).getLink();
        Connection conn = MysqlLinking.conn;
        Boolean bool = false;

        try {
            String sql = "update student set gpa=? where S_No=?";
            PreparedStatement ps = conn.prepareStatement(sql);
            ps.setDouble(1, gpa);
            ps.setString(2, No);
            int rs = ps.executeUpdate();
            if (rs > 0) {
                bool = true;
            }

            ps.close();
        } catch (Exception var14) {
            Exception e = var14;
            e.printStackTrace();
        }

        return bool;
    }
}